package show.me.the.money.service.core;

import java.util.HashMap;

import org.apache.commons.lang.StringUtils;

import show.me.the.money.util.collect.OnlineUserInfoCollector;
import show.me.the.money.util.context.Context;


public class OnlineHandler implements Service{

	@Override
	public void execute(HashMap<String, Object> req,
			HashMap<String, Object> res, Context ctx) {
		String op = (String) req.get("op");
		if(!StringUtils.isEmpty(op)){
			if(op.equals("count")){
				res.put("body", OnlineUserInfoCollector.instance().getOnlineUsersAmount());
			}
		}
		else{
			res.put("body", OnlineUserInfoCollector.instance().getOnlineUsers());
		}		
	}
}
